﻿using System;
using System.Reflection;

namespace dz.inner.jky.api
{
    internal class FieldAttrib
    {
        private string name;

        /// <summary>
        /// 是否忽略
        /// </summary>
        public bool IsIgnore { get; set; } = false;

        public FieldAttrib(PropertyInfo pi)
        {
            name = pi.Name;
        }
        /// <summary>
        /// 别名
        /// </summary>
        public string Alias { get; set; } = string.Empty;

        /// <summary>
        /// 字段类型
        /// </summary>
        public FieldTypeEnum FieldType { get; set; } = FieldTypeEnum.Normal;

        /// <summary>
        /// 属性
        /// </summary>
        public Attribute Attribute { get; set; }

        /// <summary>
        /// 全限定名
        /// </summary>
        public string FullType { get; set; }

        /// <summary>
        /// 属性名
        /// </summary>
        public string Name 
        {
            get { return Alias.Length > 0 ? Alias : name;}            
        }


    }

    public enum FieldTypeEnum
    {
        /// <summary>
        /// 基础类型字段
        /// </summary>
        Normal,

        /// <summary>
        /// 简单类型对象
        /// </summary>
        SimpleObject,

        /// <summary>
        /// 复杂类型对象
        /// </summary>
        ComplexObject,

        /// <summary>
        /// 枚举对象
        /// </summary>
        EnumObject,

        /// <summary>
        /// 对象集合
        /// </summary>
        ListObject

    }
}
